home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-12-17 | 15.6 KB | 431 lines | [TEXT/MPS ] |
- #
- # ****************************************************************************
- #
- # File Name: Director.vu
- #
- # Contains: Quick look test script for Director version 3.1
- #
- # Written by: Kevin Avoy, Ken Landreth, Michael Leong, Gil Spencer et al
- #
- # Copyright: © 1993 by Apple Computer, Inc., all rights reserved.
- #
- # ****************************************************************************
- # C h a n g e H i s t o r y (most recent first):
- # ****************************************************************************
- #
- # Vers Date Author Description
- # ---- -------- ------ ---------------------------------------------
- # <1.0.6> 9/28/93 KTA Added returnVal for ModifyDocument hook.
- # <1.0.3> 7/22/93 KTA Updated references to GetGestaltMachineType() which name has
- # been changed to GestaltMachineType().
- # <1.0.2> 6/16/93 NAGA Renaming InitGlobals(ScriptLevel)to InitGlobals(ScriptLevel)
- # <1+> 5/25/93 NAGA Adding header and porting old files to follow new standards
- #
- # ****************************************************************************
- #
-
-
-
- ########################################################################
- # External libraries
- #=======================================================================
- Libraries "Output.Lib", "DoTasks.Lib","Draw.Lib","Gestalt.Lib", "UserInterface.Lib","Da.Lib", "Font.Lib", "Globals.Lib", "LaunchQuit.Lib", "TCS.Lib";
-
-
- #########################################################################
- ######## Application Specific Tasks
- #########################################################################
-
- #########################################################################
- # InitAppGlobals()
- #========================================================================
- # Author: ML
- # Description: Sets up tools and fonts for Director. This task
- # must be called first.
- # Parameters: None
- # Returns: Nothing
- # Examples: InitAppGlobals()
- #========================================================================
- # History:
- #
- ########################################################################
- task InitAppGlobals()
- begin
-
- logstr("setting up {global gApptitle}'s globals");
- global kClick, kDrag, kDragClick, kMultiDrag, kMultiClickDrag, kMultiClick;
- global kPalDocWind, kPalWind, kPullOffPal, kPopUpPal, kScrollPal, gTextStr ;
-
- global kToolPaletteNum := 1;
- global kColorPaletteNum := 2;
- global kPatternPaletteNum := 3;
- #global kLinePaletteNum := 4;
- #global kGradientPaletteNum := 5;
-
- global gPaletteList := {
- {
- { 1,58, 51,223,1}, #Main Tool Matrix (Pallete #1)
- kPalDocWind,
- {2,8}, #tool matrix
- {26,20} #tool offset
- },
-
- {
- { 18,270, 53,256,1 }, #Color Matrix (Pallete #2)
- kPopUpPal,
- {16,16}, #tool matrix
- {8,8} #tool offset
- },
-
- {
- { 25,302, 54,295, 1}, #Pattern Matrix (Pallete #3)
- kPopUpPal,
- {8,8}, #tool matrix
- {20,20} #tool offset
- },
-
- {
- { 17,308, 42,308 }, #Line Weight Matrix (Pallete #4)
- kPalDocWind,
- {1,5}, #tool matrix
- {0,5} #tool offset
- }
- };
-
- ### Palette Elements:= Tool#, Pal#, ToolName, ToolType, DblClktoEnd SetAttributes
- global FreeSelectTool := { 1, 1, "FreeSelect", kMultiDrag, 0, {0} };
- global RectSelectTool := { 2, 1, "RectSelect", kDrag, 0, {0} };
- global HandTool := { 3, 1, "HandTool", kDrag, 0, {0} };
- global CharTool := { 4, 1, "CharTool", kClick, 0, {0} };
- global FillTool := { 5, 1, "FillTool", kClick, 0, {1,0,0,1} };
- global AirBrush := { 6, 1, "AirBrush", kMultiDrag, 0, {1,0,0,1} };
- global PaintBrush := { 7, 1, "PaintBrush", kMultiDrag, 0, {1,1,0,1} };
- global PencilTool := { 8, 1, "PencilTool", kMultiDrag, 0, {1,0,0,1} };
- global RectTool := {9, 1, "Rectangle", kDrag, 0, {1,1,1,1} };
- global Eraser := {10, 1, "Eraser", kMultiDrag, 0, {0} };
- global OvalTool := {11, 1, "Oval", kDrag, 0, {1,1,1,1} };
- global PolyTool := {12, 1, "Polygon", kMultiClick,1, {1,1,1,1} };
- global LineTool := {13, 1, "Line", kDrag, 0, {1,0,1,0} };
- global CurveTool := {14, 1, "Curve", kDragClick, 0, {1,1,1,1} };
- global PositionTool := {15, 1, "PositionTool", kMultiDrag, 0, {0} };
- global ColorPickup := {16, 1, "ColorPickup", kClick, 0, {0} };
-
-
- theMachine := gestalt('mach'); #Test to see if this is a black and white machine
-
- if ( theMachine < 6 or theMachine = 9 or theMachine = 21 or theMachine = 23 or theMachine = 24 or theMachine = 25 or theMachine = 26)
- begin
- SE30With2Monitors := 0;
- if (GestaltMachineType(theMachine) = 'MacSE030') #Is this an SE30?
- begin
- monitorList := collect[screen];
-
- if ( monitorList.p > 1 ) # Is the main monitor greater than 1 bit?
- SE30With2Monitors := 1;
-
- if card(monitorList > 1) # If there's a second monitor...
- begin
- if (monitorList[2].p > 1) # is the second monitor greater than 1 bit?
- SE30With2Monitors := 1;
- end;
-
- if not(SE30With2Monitors)
- begin
- global gPaletteList := {
- {
- { 0,58, 51,223,1}, #Main Tool Matrix (Pallete #1)
- kPalDocWind,
- {2,8}, #tool matrix
- {26,20} #tool offset
- },
-
- {
- { 18,270, 53,256,1 }, #Color Matrix (Pallete #2)
- kPopUpPal,
- {16,16}, #tool matrix
- {8,8} #tool offset
- },
-
- {
- {30,300, 57,215,1}, #Pattern Matrix (Pallete #3)
- kPopUpPal,
- {8,8}, #tool matrix
- {20,20} #tool offset
- },
-
- {
- { 23,307, 23,342 }, #Line Weight Matrix (Pallete #4)
- kPalDocWind,
- {1,5}, #tool matrix
- {0,5} #tool offset
- }
- };
-
- ### Palette Elements:= Tool#, Pal#, ToolName, ToolType, DblClktoEnd SetAttributes
- global FreeSelectTool := { 1, 1, "FreeSelect", kMultiDrag, 0, {0} };
- global RectSelectTool := { 2, 1, "RectSelect", kDrag, 0, {0} };
- global HandTool := { 3, 1, "HandTool", kDrag, 0, {0} };
- global CharTool := { 4, 1, "CharTool", kClick, 0, {0} };
- global FillTool := { 5, 1, "FillTool", kClick, 0, {0} };
- global AirBrush := { 6, 1, "AirBrush", kMultiDrag, 0, {0} };
- global PaintBrush := { 7, 1, "PaintBrush", kMultiDrag, 0, {1,1,0,0} };
- global PencilTool := { 8, 1, "PencilTool", kMultiDrag, 0, {0} };
- global RectTool := { 9, 1, "Rectangle", kDrag, 0, {1,1,1,1} };
- global Eraser := {10, 1, "Eraser", kMultiDrag, 0, {0} };
- global OvalTool := {11, 1, "Oval", kDrag, 0, {1,1,1,0} };
- global PolyTool := {12, 1, "Polygon", kMultiClick,1, {1,1,1,0} };
- global LineTool := {13, 1, "Line", kDrag, 0, {1,0,1,0} };
- global CurveTool := {14, 1, "Curve", kDragClick, 0, {1,1,1,0} };
- global PositionTool := {15, 1, "PositionTool", kMultiDrag, 0, {0} };
- global ColorPickup := {16, 1, "ColorPickup", kClick, 0, {0} };
- end;
-
- end;
- end;
-
- global gToolList:={
- global RectSelectTool,
- global HandTool,
- #global CharTool,
- global FillTool,
- global AirBrush,
- global PaintBrush,
- global PencilTool,
- global RectTool,
- global Eraser,
- global OvalTool,
- global PolyTool,
- global LineTool,
- global CurveTool,
- global PositionTool,
- global ColorPickup
- };
-
- global gToolList:={ CurveTool, OvalTool };
-
- ### font characteristic lists
- global gFontSizeList := {'9','10','12','14','18', '24','36','48','72'};
- global gFontStyleList := {'Bold','Italic','Outline', 'Underline','Shadow'};
-
- ### Name of the Plain (style) menu item ####
- global gPlainStyle := "Plain"; # Plain-Style menu item
-
- ### How to get to the next line
- global gNextLineMethod := 1;
- ### 1 - ReturnKey, 2 - EnterKey, 3 - DownArrow Key, 4 - TabKey, {} - Move/Click, {'Untitled'} - Move relative to the window titled 'Untitled' /Click
-
- ### Does moving to the next line clear all font info
- global gNextLineClearsFontSettings := 0;
-
- global gWindowInset := {60,20,20,20}; # Inset to wind to get content region
-
- end; # InitAppGlobals
-
- #########################################################################
- # SetupDirectorForDraw()
- #========================================================================
- # Author: GS (x25506)
- # Description: Will make sure that Director is in Studio mode and that
- # the paint window is open and zoomed and that the cast window is open.
- # Parameters: None
- # Returns: Nothing
- # Examples: SetupDirectorForDraw();
- # Assumptions: Director has launched
- #========================================================================
- # History:
- #
- #########################################################################
- task SetupDirectorForDraw()
- begin
- ToStudio(); # Make sure we're in Studio
- SetFrontWindow('Paint'); # Make sure the Paint Window's open
- SizeWindow(515,385); # make sure all palettes available
- end;
-
- #########################################################################
- # DirectorScrapText()
- #========================================================================
- # Author: GS (x25506)
- # Description: Test Scraptext
- # Parameters: None
- # Returns: Nothing
- # Examples: DirectorScrapText();
- # Assumptions: Director has launched
- #========================================================================
- # History:
- #
- #########################################################################
- task DirectorScrapText()
- begin
- logstr("Setting up for scraptext");
- SelectMenuItem("Text","Window");
- MoveRelativeToWindow(,,"Text",2);
- Scrapbook(global kScrapTEXT);
- CloseWindow(,,"Text");
- SelectMenuItem("Paint","Window"); # get ready for scrappict
- end;
-
- #########################################################################
- # DoTextDirector()
- #========================================================================
- # Author: GS (x25506)
- # Description: Test Text
- # Parameters: None
- # Returns: Nothing
- # Examples: DoTextDirector();
- # Assumptions: Director has launched
- #========================================================================
- # History:
- #
- #########################################################################
- task DoTextDirector()
- begin
- logstr("Setting up for DoText");
- Draw(global CharTool);
- DoText();
- end;
-
- #########################################################################
- # DoDrawDirector()
- #========================================================================
- # Author: GS (x25506)
- # Description: Test Draw
- # Parameters: None
- # Returns: Nothing
- # Examples: DoDrawDirector();
- # Assumptions: Director has launched
- #========================================================================
- # History:
- #
- #########################################################################
- task DoDrawDirector()
- begin
- SetupDirectorForDraw();
- DoDraw();
- end;
-
- #########################################################################
- # DirectorModifyDocument()
- #========================================================================
- # Author: ML
- # Description: Modify Director Document
- # Parameters: None
- # Returns: Nothing
- # Examples: DirectorModifyDocument();
- # Assumptions: None
- # Applications: Canvas
- #========================================================================
- # History:
- #
- #########################################################################
- task DirectorModifyDocument()
- begin
- Logstr("Modifying document...");
- theReturn := Scrapbook(global kScrapPICT);
- if match [button t:"Paste and Replace Cast"]!;
- SelectButton("Paste and Replace Cast");
- if match [button t:"Remap Colors"]!;
- SelectButton("Remap Colors");
- return(theReturn);
- end;
-
- #########################################################################
- # ToStudio()
- #========================================================================
- # Author: KTA (x45604)
- # Description: Will Make sure that the current module is Studio by checking
- # for the 'To Studio' menuItem if its there it will select it.
- # Applications: Director in either module.
- ################################################################################
- task ToStudio() begin
- Studio := match[menuitem o:1 m:[menu o:2]];
- if (Studio.t = 'To Studio')
- selectMenuItem("To Studio", "File");
- else
- LogStr("Studio is the current module.",3);
- end;
-
-
-
- ################################################################################
- # Name: SetFrontWindow(windowName) Author: DM (x41220)
- # Description: Brings specified window to the front.
- # Params: WindowName - Use names in window menu
- # Applications: Director in either module.
- ################################################################################
- task SetFrontWindow(windowName) begin
- if not (match[window t:/≈"{windowName}"/ o:1]!)
- SelectMenuItem(windowName, "Window");
- end;
-
-
- #########################################################################
- # Animate()
- #========================================================================
- # Author: KTA
- # Description: Will Move to a location on the Screen hold down the 'Option' and "Command'
- # Key while dragging the mouse to Animate in real time.
- # Parameters: None
- # Returns: Nothing
- # Examples: Animate();
- # Assumptions: None
- # Applications: Director in the Studio Module. With a cast member selected and only the Cast window Open (Panel Window is OK if it open)
- # This task is equivelant to a Views() task in other QLz.
- #========================================================================
- # History:
- #
- #########################################################################
- task Animate() begin
-
- SelectMenuItem( "Paint", "Window");
-
- MoveRelativeToWindow(30,30,'Stage');
- pressKey k:{OptionKey, commandKey};
- pressMouse;
-
- for x := 1 to 4
- MoveRelativeToWindow(,,'Stage');
- LogStr('Animating in Real time',3);
-
- releaseMouse;
- releaseKey k:{OptionKey, commandKey};
- wait(30);
- selectMenuItem("Stop", "Control");
- SetFrontWindow("Panel"); # Open the Cast Window
- selectMenuItem("Paint", "Window"); # get ready for dowindow
- end;
-
- ################################################################################
- #################### Main script ####################
- ################################################################################
- script Director (ScriptLevel:= -1)
- begin
- InitGlobals(ScriptLevel); # initialize your general globals
- InitDraw();
- InitFonts();
- Global gApptitle := "MacroMind Director";
- global gAppVersion := '3'; # version of app you will be running
- SuiteStart('Director.vu'); # begin a new test suite
- if LaunchTwitch("{gAppTitle}",gAliasDirectory) # launch or twitch to your app
- begin
- global gFileName := "@!@-{gBuildVers}-Director"; # This is used in NameOK when saving files
- global gCustomScrapText:= task DirectorScrapText; # define app specific task
- global gModifyDocument:= task DirectorModifyDocument; # define app specific task
- InitAppGlobals(); # init app specific globals
- (*
- *)
- DoSetUpApp(,,,,1,1,1);
- Logstr ("!@#$% Expected errors above - '!@#$% No open window with grow and
- zoom boxes' and '!@#$% It appears that the wrong file was opened, BuckWheat
- - undefined' because SF Get does not open a document window");
- DoDrawDirector();
- DoTextDirector();
- Animate();
- DoWindow();
- DoCloseApp(1);
- if match [Button t:"OK"]!
- SelectButton("OK");
- end; # if LaunchTwitch("{gAppTitle}",gAliasDirectory)
- SuiteEnd();
- end; # script Director
-